<div class="tableToolbar">
	<div class="coll-md-9" id="addInput">
		<div class="coll-md-1">
			<input type="text" class='search' placeholder="项目名称" ng-model="ctrlScope.itemsearch.itemname">
		</div>
		<!--<div class="coll-md-1">-->
			<!--<input type="text" class='search' placeholder="担保公司" ng-model="ctrlScope.itemsearch.guaranteeUserName">-->
		<!--</div>-->
		<div class="coll-md-1 triangle">
			<select class="form-control" ng-model="ctrlScope.itemsearch.repayStatus">
				<option  value="" disabled selected hidden>还款状态</option>
				<option value="0">未还款</option>
				<option value="1">借款人还款</option>
				<option value="2">标的还款</option>
			</select>
		</div>
		<div class="coll-md-6 scalenone"  id="searchdate" datahide>
			<div class="coll-md-25" >
				<p class="input-group">
					<input type="text" class="search" placeholder="应还开始时间" uib-datepicker-popup="yyyy-MM-dd"
						   ng-model="ctrlScope.itemsearch.repayStartTimex" is-open="popup1.opened" datepicker-options="dateOptions"/>
						<span class="input-group-btn">
							            <button type="button" class="small-icon btn btn-default" ng-click="open1()"><i
												class="glyphicon glyphicon-calendar"></i></button>
							          </span>
				</p>
			</div>
			<div class="coll-md-25">
				<p class="input-group inline">
					<input type="text" class="search" placeholder="应还结束时间" uib-datepicker-popup="yyyy-MM-dd"
						   ng-model="ctrlScope.itemsearch.repayEndTimex" is-open="popup2.opened" datepicker-options="dateOptions"/>
						<span class="input-group-btn">
							            <button type="button" class="small-icon btn btn-default" ng-click="open2()"><i
												class="glyphicon glyphicon-calendar"></i></button>
							          </span>
				</p>
			</div>
			<div class="coll-md-25" >
				<p class="input-group">
					<input type="text" class="search" placeholder="已还开始时间" uib-datepicker-popup="yyyy-MM-dd"
						   ng-model="ctrlScope.itemsearch.actualStartTimex" is-open="popup3.opened" datepicker-options="dateOptions"/>
						<span class="input-group-btn">
							            <button type="button" class="small-icon btn btn-default" ng-click="open3()"><i
												class="glyphicon glyphicon-calendar"></i></button>
							          </span>
				</p>
			</div>
			<div class="coll-md-25">
				<p class="input-group inline">
					<input type="text" class="search" placeholder="已还结束时间" uib-datepicker-popup="yyyy-MM-dd"
						   ng-model="ctrlScope.itemsearch.actualEndTimex" is-open="popup4.opened" datepicker-options="dateOptions"/>
						<span class="input-group-btn">
							            <button type="button" class="small-icon btn btn-default" ng-click="open4()"><i
												class="glyphicon glyphicon-calendar"></i></button>
							          </span>
				</p>
			</div>
		</div>
		<div class="coll-md-1">
			<input type="button" class="small-icon search2-icon" value="搜索" ng-click="search()">
			<input type="button" class="small-icon search2" value="搜索">
			<input type="button" class="small-icon reset-icon" reset-icon value="重置" ng-click="reset()">
			<input type="button" class="small-icon reset" value="重置">

			<div class="dropdown-menu-right">
				<input type="button" class="small-icon more-icon" value="更多" title='更多搜索项' id="more-icon" data-toggle="dropdown"
					   aria-haspopup="true" aria-expanded="false">
				<input type="button" class="small-icon more" value="更多">
				<ul class="dropdown-menu" style='margin-left:80px;' aria-labelledby="dropdownMenu2" more-search>
					<li><a href="javascript:;">日期搜索</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="coll-md-1">
		<button class="small-icon btn btn-default pos-right" id="itemExport" ng-click="download()">
			<i class="fa fa-download"></i>
		</button>
	</div>
</div>
<table  style="margin-bottom:20px;">
	<tr>
		<td class="blue" width="16%">
			<h6>借款人已还项目</h6>
			<h4 ng-model="show.repayItemNum">{{show.repayItemNum}}个</h4>
		</td>
		<td class="red" width="16%">
			<h6>借款人已还总金额</h6>
			<h4 ng-model="show.repayItemAccount">{{show.repayItemAccount}}元</h4>
		</td>
		<td class="blue" width="16%">
			<h6 >借款人已还利息总额</h6>
			<h4 ng-model="show.repayItemInterest">{{show.repayItemInterest}}元</h4>
		</td>
		<td class="red" width="16%">
			<h6 >未还款项目</h6>
			<h4 ng-model="show.noRepayItemNum">{{show.noRepayItemNum}}个</h4>
		</td>
		<td class="blue" width="16%">
			<h6 >未还款总金额</h6>
			<h4 ng-model="show.noRepayItemAccount">{{show.noRepayItemAccount}}元</h4>
		</td>
		<td class="red" width="16%">
			<h6 >未还利息总额</h6>
			<h4 ng-model="show.noRepayItemInterest">{{show.noRepayItemInterest}}元</h4>
		</td>
	</tr>
</table>
<table ui-table="orderParams">
	<thead>
		<tr>
			<th>项目名称</th>
			<!--<th>担保公司</th>-->
			<th>用户名</th>
			<th>真实姓名</th>
			<th>项目id</th>
			<th>当期期数</th>
			<th >总期数	</th>
			<th >应还总额</th>
			<th >应还本金</th>
			<th >应还利息</th>
			<!--<th >应还服务费</th>-->
			<th >应还时间</th>
			<th >加息券利息</th>
			<th >已还总额</th>
			<th >已还本金</th>
			<th >已还利息</th>
			<th >已还时间</th>
			<th>还款状态</th>
			<!--<th>操作</th>-->
		</tr>
	</thead>
	<tbody>
		<tr ng-repeat="item in orderParams.$rows">
			<td>{{item.itemName}}</td>
			<!--<td>{{item.guaranteeUserName}}</td>-->
			<td>{{item.username}}</td>
			<td>{{item.realname}}</td>
			<td>{{item.itemId}}</td>

			<td>{{item.repayCurrentPeriod}}</td>
			<td>{{item.repayTotalPeriod}}</td>
			<td>{{item.repayAmount}}</td>
			<td>{{item.repayPrincipal}}</td>
			<td>{{item.repayInterest}}</td>
			<!--<td>{{item.serveAmount}}</td>-->
			<td>{{item.repayTime |date:'yyyy-MM-dd'}}</td>
			<td>{{item.additionalRateAmount}}</td>
			<td>{{item.actualRepayAmount}}</td>
			<td>{{item.actualRepayPrincipal}}</td>
			<td>{{item.actualRepayInterest}}</td>
			<td>{{item.actualRepayTime |date:'yyyy-MM-dd'}}</td>
			<td>
				<a ng-if="item.status==0" ng-click="confirmBtn(item.itemId,item.repayCurrentPeriod,2)">借款人还款</a>
				<a ng-if="item.status==1" ng-click="confirmBtn(item.itemId,item.repayCurrentPeriod,1)">标的还款</a>
				<span ng-if="item.status !=0 ">{{item.status | paymentStatus}}</span>

			</td>
			<td>
				<!--<a ng-click="generateContractModal(item.itemId)">生成合同</a>-->
				<!--<a ng-click="checkContractModal(item.itemId)">查看合同</a>-->
				<a ng-if="item.status ==3" ng-click="openStatus3Modal(item.itemId)">还款审核</a>
			</td>
		</tr>
	</tbody>
</table>

<modal title="还款确认" visible="confirmModal">
	<form class="form-horizontal" role="form" name="myForm">
		<div class="form-body">
			<div style="text-align: center;font-size:16px;">确认还款吗？</>
			<div class="col-md-12 buttonArea">
				<button  class="btn blue"  ng-click="modifyModal()">确定</button>
				<button  class="btn gray" ng-click="closeBtn()">取消</button>
			</div>
		</div>
	</form>
</modal>



<modal title="还款审核" visible="status3Modal">
	<form class="form-horizontal" role="form" name="myForm">
		<div class="form-body">
			<div class="row">
				<div class="col-md-12">
					<div class="form-group">
						<label class="control-label col-md-2">查询结果</label>
						<div class="col-md-10">
							{{add.respSubdes}}
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-12">
					<div class="form-group">
						<label class="control-label col-md-2">项目状态</label>
						<div class="col-md-4">
							<select class="form-control" ng-model="add.status" ui-select2="select2Options" disabled>
								<option value="W">等待中</option>
								<option value="II">投资中</option>
								<option value="GI">放款中</option>
								<option value="GD">已放款</option>
								<option value="CI">流标中</option>
								<option value="CD">已流标</option>
								<option value="F">失败</option>
							</select>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-12">
					<div class="form-group">
						<label class="control-label col-md-2">密码</label>
						<div class="col-md-4">
							<input class="form-control" type="password" ng-model="add.password">
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-12 buttonArea">
				<button type="button"  class="btn blue"  ng-click="repayStatus()" ng-disabled="add.status!=GD">还款审核</button>
			</div>
		</div>
	</form>
</modal>
<modal title="查看合同" visible="contractModal">
	<form class="form-horizontal" role="form">
		<div class="form-body">
			<table ui-table="contractParms">
				<thead>
				<tr>
					<th>合同编号</th>
					<th>手机号码</th>
					<th>真实姓名</th>
					<th>生成时间</th>
					<!--<th>借款内容</th>-->
					<th>操作</th>
				</tr>
				</thead>
				<tbody>

				<tr ng-repeat="item in contractParms.$rows">
					<td>{{item.serialNumber}}</td>
					<td>{{item.mobile}}</td>
					<td>{{item.realname}}</td>
					<td>{{item.addtime | date:'yyyy-MM-dd HH:mm:ss'}}</td>

					<!--<td>{{item.contents}}</td>-->
					<td>
						<a ng-click="openURL(item.url)">查看</a>
						<a download="{{item.serialNumber}}" href="{{item.url}}">下载</a>
						<a ng-click="deleteContract(item.id)">删除</a>
					</td>
				</tr>
				</tbody>
			</table>
		</div>
	</form>

</modal>
